package com.example.springadvance.a07;

import jakarta.annotation.PreDestroy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;

public class LifeCycleBean implements InitializingBean, DisposableBean {

    @PostConstruct
    public void postConstruct() {
        System.out.println("LifeCycleBean postConstruct");
    }


    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("LifeCycleBean DisposableBean destroy");
    }

    public void initMethod() {
        System.out.println("LifeCycleBean initMethod");
    }

    @PreDestroy
    public void preDestroy() {
        System.out.println("LifeCycleBean preDestroy");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("LifeCycleBean InitializingBean destroy");
    }

    public void destroyMethod() {
        System.out.println("LifeCycleBean destroyMethod");
    }
}
